package com.cos.shop.web.controller;

import com.alibaba.fastjson.JSON;
import com.cos.shop.common.ResponseResult;
import com.cos.shop.services.TypeServices;
import com.cos.shop.services.impl.TypeServicesImpl;

import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * @author: COS
 * @time: 2023/5/11 10:10
 * @description:
 */
@WebServlet("/type")
public class TypeController extends BaseServlet {
    private TypeServices ts = new TypeServicesImpl();

    public String getAll(HttpServletRequest request, HttpServletResponse response) {
        // ajax 转JSON
        ResponseResult all = ts.getAll();
        String s = JSON.toJSONString(all);
        return s;
    }
}
